package com.liuhuxiang.order.feign;

import com.liuhuxiang.order.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 商品：查询商品接口
 *
 * @author liuhuxiang
 * @version: ProductFeignService.java, 2023年03月02日 下午3:02 liuhuxiang  Exp $
 */
//name用来指定，你需要调用的rest接口是哪个服务的
//path用来指定调用接口对应的controller对应的requestMapping,如果controller上没有，那path就不用指定了
//全局配置就不用加configuration  @FeignClient(name = "product-service", path = "/product")
@FeignClient(name = "product-service", path = "/product" ,configuration = FeignConfig.class)
public interface ProductFeignService {

    //这里Feign的语法要求更加严格，@PathVariable后面的字段名称id一定要指定，否则会报错
    @RequestMapping("/{id}")
    String get(@PathVariable("id") Integer id);

}